<%@page import="com.yunhuakeji.wddx.utils.IsNull"%>
<%@page import="net.sf.json.JSONObject"%>
<%@page import="net.sf.json.JSONArray"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
JSONObject obj;
try{
     obj = JSONObject.fromObject(request.getAttribute("result"));
}catch(Exception e){
     obj = null;
}
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    <title>按时归寝</title>
     <meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no,minimum-scale=1.0,maximum-scale=1.0">
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<link rel="stylesheet" type="text/css" href="css/myreport.css">
	<script src="js/jquery.min.js"></script>
	<script src="js/echarts.min.js" type="text/javascript"></script>
	<script src="js/myReport.js"></script>
  </head>
  <style>
  	
  </style>
  <body style="background:#eeeeee;">
    <%if(!obj.isNullObject()){ 
    	JSONObject tmp = JSONObject.fromObject(JSONObject.fromObject(obj.get("content")).get("message"));
        JSONArray tjxx = tmp.getJSONArray("tjxx");
        JSONArray gqsj = tmp.getJSONArray("gqsj");
  	    ArrayList arr = new ArrayList();
  	    for(int i=0;i<gqsj.size();i++){
  	          ArrayList arr1 = new ArrayList();
  	          arr1.add(gqsj.getJSONObject(i).getString("rq"));
  	          arr1.add(gqsj.getJSONObject(i).getString("fd"));
  	          arr.add(arr1);
  	     }
    %>
  	<!-- home -->
  	<script>
  	     var pm = "<%=tjxx.getJSONObject(0).getString("pm")%>";
  	     var qssj ="<%=tjxx.getJSONObject(0).getString("qssj")%>";
		 var jssj ="<%=tjxx.getJSONObject(0).getString("jssj")%>";
		 var data=<%=arr%>;
  	</script>
  	<div class="daily" style="background:white;">
    	<div class="daily-date">
    		<a><img alt="" src="images/daily-calendar.png"><span>第<%=tjxx.getJSONObject(0).getString("djz") %>周</span></a>
    		<a><%=tjxx.getJSONObject(0).getString("xqj") %>	<%=tjxx.getJSONObject(0).getString("rq") %></a>
    		<div class="clear"></div>
    	</div>
    	<div class="text-center">
    		<canvas id="gaugechart"></canvas>
    	</div>
    	<div class="daily-describe2">
    		<ul>
    			<li><a>今日状态:<span><%=tjxx.getJSONObject(0).getString("status") %></span></a></li>
    			<li><a>归寝平均时间:<span><%=tjxx.getJSONObject(0).getString("avgtime") %></span></a></li>
    			<div class="clear"></div>
    		</ul>
    	</div>
  	</div>
  	<div class="daily-month mt1em bg-color-white">
    		<div id="echart">
    		</div>
    		<div class="daily-month-ul">
	    		<ul>
	    		<%JSONArray fdms = tmp.getJSONArray("fdms");
	    		  for(int i=0;i<fdms.size();i++){
	    		 %>
	    			<li><a><%=fdms.getJSONObject(i).getString("fd") %></a></li>
	    		<%} %>
	    			<div class="clear"></div>
	    		</ul>
    		</div>
    </div>
    <%} %>
 <script src="js/myreport/timetosleep.js"></script>
  </body>
</html>
